﻿CREATE PROCEDURE [dbo].[AddComment]
	@CommentId uniqueidentifier,
	@Activity uniqueidentifier,
	@CreatedBy uniqueidentifier,
	@Text nvarchar(max),
	@Priority int,
    @IsDeleted bit,
	@Date datetime,
	@LastChanged datetime,
	@LastChangedBy uniqueidentifier,

	@TimeStamp timestamp output

AS

	INSERT INTO Comment 

	(CommentId, Activity, CreatedBy, [Text], [Priority], IsDeleted, [Date], LastChanged, LastChangedBy)

	VALUES 

	(@CommentId, @Activity, @CreatedBy, @Text, @Priority, @IsDeleted, @Date, @LastChanged, @LastChangedBy)

	SELECT @TimeStamp = [TimeStamp]

	FROM Comment WHERE CommentId=@CommentId

RETURN 0